package com.taobao.txc.common.c;

import com.taobao.txc.common.LoggerInit;
import com.taobao.txc.common.LoggerWrap;
import com.taobao.txc.common.b.b;
import io.netty.buffer.ByteBuf;
import java.nio.ByteBuffer;
import java.util.Map;

public class E
  extends F
  implements p
{
  public a[] a;
  private static final LoggerWrap b = LoggerInit.logger;
  
  public a[] b()
  {
    return this.a;
  }
  
  public short b_()
  {
    return 20;
  }
  
  public byte[] c()
  {
    ByteBuffer localByteBuffer = ByteBuffer.allocate(this.a.length * 1024);
    localByteBuffer.putShort((short)this.a.length);
    for (a locala : this.a)
    {
      locala.a(this.k);
      byte[] arrayOfByte2 = locala.c();
      localByteBuffer.putShort(locala.b_());
      localByteBuffer.put(arrayOfByte2);
    }
    localByteBuffer.flip();
    int i = localByteBuffer.limit();
    byte[] arrayOfByte1 = new byte[i + 4];
    a(i, arrayOfByte1, 0);
    localByteBuffer.get(arrayOfByte1, 4, i);
    if ((this.a.length > 20) && (b.c())) {
      b.debug("msg in one txc merge packet:" + this.a.length + ",buffer size:" + arrayOfByte1.length);
    }
    return arrayOfByte1;
  }
  
  public boolean a(ByteBuf paramByteBuf)
  {
    int i = paramByteBuf.readableBytes();
    if (i < 4) {
      return false;
    }
    i -= 4;
    int j = paramByteBuf.readInt();
    if (i < j) {
      return false;
    }
    byte[] arrayOfByte = new byte[j];
    paramByteBuf.readBytes(arrayOfByte);
    ByteBuffer localByteBuffer = ByteBuffer.wrap(arrayOfByte);
    a(localByteBuffer);
    return true;
  }
  
  public void a(ByteBuffer paramByteBuffer)
  {
    int i = paramByteBuffer.getShort();
    this.a = new a[i];
    for (int j = 0; j < i; j++)
    {
      short s = paramByteBuffer.getShort();
      Object localObject = null;
      switch (s)
      {
      case 2: 
        localObject = new c();
        break;
      case 16: 
        localObject = new e();
        break;
      case 12: 
        localObject = new w();
        break;
      case 14: 
        localObject = new y();
        break;
      case 18: 
        localObject = new A();
        break;
      case 4: 
        localObject = new g();
        break;
      case 6: 
        localObject = new i();
        break;
      case 8: 
        localObject = new m();
        break;
      case 10: 
        localObject = new o();
        break;
      case 22: 
        localObject = new s();
        break;
      case 3: 
      case 5: 
      case 7: 
      case 9: 
      case 11: 
      case 13: 
      case 15: 
      case 17: 
      case 19: 
      case 20: 
      case 21: 
      default: 
        String str = (String)F.l.get(Short.valueOf(s));
        throw new com.taobao.txc.common.b.c("unknown class:" + str + " in txc merge result message.", b.aq);
      }
      ((F)localObject).a(this.k);
      ((q)localObject).a(paramByteBuffer);
      this.a[j] = ((a)localObject);
    }
  }
  
  public String toString()
  {
    StringBuilder localStringBuilder = new StringBuilder("TxcMergeResultMessage ");
    for (a locala : this.a) {
      localStringBuilder.append(locala.toString()).append("\n");
    }
    return localStringBuilder.toString();
  }
}


/* Location:           C:\Users\ibm\Downloads\txc-yun-sample (1)\txc-yun-sample\lib\txc-client-2.0.72.jar
 * Qualified Name:     com.taobao.txc.common.c.E
 * JD-Core Version:    0.7.0.1
 */